<template>
  <div class="phone">
    <div class="top">
      <div class="desc">服务通知</div>
    </div>
    <div class="wechat-preview">
      
      <div class="main-content">
        <div class="row">
          
          <div class="text-box">
            <div class="title">{{title}}</div>
            <div class="content">{{ content || "请输入内容" }}</div>
            <div class="bottom">进入小程序查看 <span class="bt-icon"><el-icon><arrow-right /></el-icon></span></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import moment from "moment";

export default {
  name: "WechatPreview",
  props: {
    content: {
      type: String,
      default: "",
    },
    title: {
      type: String,
      default: "",
    },
   
  },
  data() {
    return {
      rules: {},
    };
  },
  watch: {
    content(val) {
      debugger
      console.log("[ this.content-watch ] >", this.content);
      console.log("[ this.val ] >", this.val);
    },
  },
  computed: {
    timer() {
      moment.locale("zh-cn");
      return moment().format("a hh:mm");
    },
  },
  mounted() {
    debugger
    console.log("[ this.content-mounted ] >", this.content);
    console.log("[ this.val ] >", this.val);
  },
};
</script>

<style scoped lang="scss">
.phone {
  width: 420px;
  height: 853px;
  background: url(//static.lianhaikeji.com/images/20210610/8ba8651148b2411ba933a7fa139a8c72.png)
    center / 100% no-repeat;
  transform: scale(0.7);
  transform-origin: left top;
  padding: 77px 23px 0;
}
 .top {
    padding: 10px 0;
    text-align: center;
    position: absolute;
    top: 35px;
    left: 50%;
    transform: translate(-50%,0);
    color: #fff;
    .desc {
      font-size: 16px;
    }
  }
.wechat-preview {
  width: 375px;
  height: calc(100% - 17px);
  overflow-y: auto;
  background: #f5f5f5;
  background-color: #ebebeb;
  border-radius: 10px;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  .main-content {
    width: 350px;
    position: absolute;
    left: 50%;
    top: 100px;
    transform: translate(-50%, 0);

    .timer {
      font-size: 16px;
      text-align: center;
      color: #9f9f9f;
      margin-bottom: 10px;
    }

    .row {
      margin-bottom: 16px;
      .text-box {
        // max-width: 250px;
        white-space: pre-wrap;
        word-wrap: break-word;
        background-color: #fff;
        margin: 0 10px 0 14px;
        border-radius: 6px;
        // padding: 20px;
        position: relative;
        font-size: 18px;
        line-height: 28px;
        .content {
          padding: 20px;
        }
      }
      .webpage {
        width: 220px;
        line-height: 20px;
        &-title {
          font-size: 16px;
          margin-bottom: 10px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
        &-desc {
          font-size: 14px;
          color: #999;
          p {
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 3;
            overflow: hidden;
            margin-right: 10px;
          }
          img {
            width: 50px;
            height: 50px;
          }
        }
      }
      .wechatMini {
        /*width: 220px;*/
        line-height: 20px;
        &-title {
          font-size: 16px;
          margin-bottom: 10px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          .icon {
            margin-right: 6px;
          }
        }
        .image {
          width: 220px;
          img {
            width: 100%;
          }
        }
      }
    }

    .avatar {
      width: 30px;
      height: 30px;
      border-radius: 4px;
      background-color: #fff;
      text-align: center;
      margin-left: 20px;

      .el-icon-user-solid {
        color: #2f88ff;
        font-size: 26px;
        line-height: 30px;
      }
    }
  }
}
.title {
  font-size: 20px;
  font-weight: 500;
  color: #303133;
  line-height: 32px;
  // margin-bottom: 15px;
  padding: 20px 20px 0 20px;
}
  .bottom {
    widows: 100%;
    color: #606266;
    height: 42px;
    font-size: 16px;
    line-height: 42px;
    border: 1px solid #EEEEEE;
    padding-left: 20px;
    .bt-icon {
      position: absolute;
      right: 20px;
      margin-top: 2px;
    }
  }
</style>
